
let names = [ '刘恒' , '刘启' , '刘彻' , '刘弗陵' , '海昏侯' , '刘病已' ];

let first = names.slice(); // 未指定参数时直接拷贝整个数组
console.log( first.toString() );

console.log( first === names ); // false

first[ 4 ] = '刘贺' ;
console.log( first.toString() );
console.log( names.toString() );

console.log( '- - - - - - - - - - - - - - -' );

let second = names.slice( 3 );
console.log( second.toString() );

console.log( '- - - - - - - - - - - - - - -' );

let third = names.slice( 2 , 5 ); // [ begin , end )
console.log( third.toString() );

console.log( '- - - - - - - - - - - - - - -' );

let x = { id:1 , name:'刘彻' }
let y = { id:2 , name:'刘据' }
let z = { id:3 , name:'刘弗陵' }

let persons = [ x , y , z ] ;
console.log( persons );

let humans = persons.slice();
console.log( humans );

persons[0].id = 1001 ;

console.log( humans[0] );